﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PBDesk.com.Extension.UmbHelper;

namespace PBDesk.com.Extension.Articles
{
    public class OArticle
    {
        public string ArtId { get; set; }
        public string MetaTitle { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public string Link { get; set; }
        public string ShortUrl { get; set; }
        public string Tags { get; set; }

        public OAuthor Author { get; set; }
        public OContentProvider ContentProvider { get; set; }

        public List<OImage> Images { get; set; }

        public OArticle()
        {
            Author = new OAuthor();
            ContentProvider = new OContentProvider();
            Images = new List<OImage>();
        }

        public OArticle(dynamic artOfDay)
        {
            if (artOfDay != null)
            {
                this.ArtId = artOfDay.articleId;
                this.MetaTitle = artOfDay.metaTitle ?? string.Empty;
                this.Title = artOfDay.itemTitle;
                this.Description = artOfDay.itemDescription;
                this.Link = artOfDay.itemLink;
                this.ShortUrl = artOfDay.articleShortUrl;
                this.Tags = MyHelper.GetTagLabels(artOfDay.Attributes["tagLabels"].Values.Values);
            }
            
            Author = new OAuthor();
            ContentProvider = new OContentProvider();
            Images = new List<OImage>();
            
        }

        
    }
}